﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>${setting.siteName} - 新增用户表</title>
    <meta name="keywords" content="${setting.siteName}">
    <meta name="description" content="${setting.siteName}">
    <!-- BEGIN HEADER -->
    <link href="${base}/resources/css/common-upload.css" rel="stylesheet">
    [#include "/admin/include/style.ftl"]
    <!-- END HEADER -->
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content  animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>新增用户表</h5>
                    <div class="ibox-tools">
                        <button type="button" class="btn btn-outline btn-white btn-xs" id="btn-return-loippi"
                                onclick="location.href='${base}/admin/tu_s_e_r/list.jhtml'"><i
                                    class="fa fa-reply-all"></i> 返回列表
                        </button>
                    </div>
                </div>
                <div class="ibox-content">
                    <form id="inputForm" class="form-horizontal" action="save.jhtml" method="post">
                        <!--/row-->
                        <div class="form-group">
                            <div class="row">
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label">昵称</label>
                                    <div class="col-sm-9">
                                        <input type="text" name="nickName" class="form-control" maxlength="200"
                                               value="${(tUSER.nickName)!''}"/>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label">手机号</label>
                                    <div class="col-sm-9">
                                        <input type="text" name="phone" class="form-control" maxlength="200"/>
                                    </div>
                                </div>
                                [#--	                               <div class="col-sm-6">--]
                                [#--                                    <label class="col-sm-3 control-label">密码</label>--]
                                [#--                                    <div class="col-sm-9">--]
                                [#--                                        <input type="password" name="password" class="form-control" maxlength="200"/>--]
                                [#--                                    </div>--]
                                [#--                                </div>--]
                            </div>
                        </div>
                        <!--/row-->

                        <div class="form-group">
                            <div class="row">
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label">邮箱</label>
                                    <div class="col-sm-9">
                                        <input type="text" name="email" class="form-control" maxlength="200"/>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label">用户备注</label>
                                    <div class="col-sm-9">
                                        <input type="text" name="remark" class="form-control" maxlength="200"/>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--/row-->


                        <!--/row-->

                        <div class="form-group">
                            <div class="row">
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label">区域名称</label>
                                    <div class="col-sm-9" data-toggle="distpicker">
                                        <select id="provinceSelect" class="col-sm-4 form-control" name="province"
                                                data-province="浙江省" style="width: 150px"></select>
                                        <select id="citySelect" class="col-sm-4 form-control" name="city"
                                                data-city="杭州市" style="width: 150px"></select>
                                        <select id="districtSelect" class="col-sm-4 form-control" name="dictrict"
                                                data-district="西湖区" style="width: 150px"></select>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label">详细地址</label>
                                    <div class="col-sm-9">
                                        <input type="hidden" name="areaName" class="form-control"/>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="row">
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label"><em
                                                style="color: red;">*&nbsp;</em>头像<br/><span
                                                style="color:#3b3999;font-size: 11px;">建议尺寸:200*200</span></label>
                                    [#--<div class="col-sm-9">
                                        <img id="imgPath" class="imgPath" src="${(tUSER.avatar)!''}"/>
                                        <input type="file" name="file" class="form-control upload"
                                               onchange="change(this)" maxlength="200" required="required"/>
                                        <input type="button" class="btn btn-warning uploadBtn" value="上传"/>
                                        <input type="hidden" name="avatar" class="form-control imagePath"
                                               maxlength="200"/>
                                    </div>--]
                                    <div class="col-sm-9">
                                        [#if tUSER.avatar==null]
                                            <img id="imgPath" class="imgPath"
                                                 src="http://qbzxxko03.bkt.clouddn.com/%E5%A4%B4%E5%83%8F.png"/>
                                        [#else]
                                            <img id="imgPath" class="imgPath" src="${(tUSER.avatar)!''}"/>
                                        [/#if]
                                        <input type="file" name="file" class="form-control upload"
                                               onchange="change(this)" maxlength="200" required="required"/>
                                        <input type="button" class="btn btn-warning uploadBtn" value="上传"/>
                                        <input type="hidden" name="avatar" class="form-control imagePath"
                                               maxlength="200"/>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label">性别</label>
                                    <div class="col-sm-9">
                                        <input type="radio" name="gender" value=0/>女
                                        <input type="radio" name="gender" value=1/>男
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-12 col-sm-offset-10">
                                <button type="button" class="btn btn-default" onclick="window.history.back();">返回
                                </button>
                                <button class="btn btn-success" type="submit">保存内容</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- BEGIN Script -->
[#include "/admin/include/script.ftl"]
<!-- END Script -->
<script>

    $(document).ready(function () {
        [@flash_message /]
        $(".chosen-select").chosen({width: "100%"});
        $(".input-daterange").datepicker({keyboardNavigation: false, forceParse: false, autoclose: true});

        $(".browserButton").browser({
            callback: function (url) {
                $("#" + $(this).attr('for')).val(url);
            }
        });

        $(".input-group.date").datepicker({
            todayBtn: "linked",
            keyboardNavigation: false,
            forceParse: false,
            calendarWeeks: true,
            autoclose: true
        });
        $.validator.addMethod("isMobile", function (value, element) {
            var length = value.length;
            var mobile = /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
            return this.optional(element) || (length == 11 && mobile.test(value));
        }, "请正确填写您的手机号码");
        $("#inputForm").validate({
            rules: {
                phone: {
                    required: true
                },
                nickName: {
                    required: true
                },
                areaName: {
                    required: true
                }
            },
            messages: {}
        });
    });

    layui.use('laydate', function () {
        var laydate = layui.laydate;
        laydate.render({
            elem: '#birthday'
            , format: 'yyyy年MM月dd日'
        });
    });

    // 上传图片
    function change(obj) {
        var that = obj;
        var formData = new FormData();
        var fileObj = $(obj)[0].files[0];
        formData.append("file", fileObj);
        $.ajax({
            url: '${base}/admin/file/upload.jhtml',
            type: 'POST',
            data: formData,
            dataType: "json",
            async: false,
            processData: false,
            contentType: false,
            success: function (data) {
                $(that).parent().find(".imgPath").show();
                $(that).parent().find(".imgPath").attr("src", data.url);
                $(that).parent().find(".uploadBtn").css({"top": "100px"});
                $(that).parent().find(".imagePath").val(data.url);
                $(that).parent().find(".uploadBtn").val("修改");
            }
        })
    }
</script>
</body>
</html>
